package itdep.services.security;

import ga.domain.repository.EntityCriteria;
import ga.domain.repository.GenericEntityFilterProcessor;
import itdep.domain.security.Account;
import org.springframework.util.StringUtils;

/**
 * @author Ivan Khalopik
 * @version $Revision: 30 $ $Date: 2010-06-19 20:18:23 +0000 (Sat, 19 Jun 2010) $
 */
public class AccountFilterProcessor extends GenericEntityFilterProcessor<Account, AccountFilter> {

	public AccountFilterProcessor() {
		super(Account.class);
	}

	@Override
	protected void processFilter(EntityCriteria criteria, AccountFilter filter) {
		if (StringUtils.hasText(filter.getEmail())) {
			criteria.add(criteria.getProperty(Account.EMAIL_PROPERTY).eq(filter.getEmail()));
		}
	}
}
